*	************************************************************************
* 	File-Name: 		TablesA8.do
*	Log-file:		----JOP_tablea8_logfiles.log
*
*	Author: 		Aycan Katitas
*
*	Data Used:  	anes12analysis.dta
*
*	Purpose:   		.do file for estimating Table A8 in Appendix
*	
*   Date Updated: July 2024
*	************************************************************************


clear
set more off

cd "/Users/aycankatitas/Desktop/Git/chinagfdi"


use "data/anes12analysis.dta", clear
quietly do "codebook/vars_codebooka8.do"

****************************************************************************
**Table A8: Chinese GFDI and Threat Perceptions, Controlling for News Consumption and Manufacturing Occupation
***************************************************************************

local indcont nationalism education econoutlook party age gender i.race manufall inmedia tvmedia prmedia rdmedia
local distcont unemploy_ivbase_d per_manu_ivbase_d perchinese_ivbase_d medinc_ivbase_d_log
local f i.sample_state
local y chinaect
qui{
ivreg2 `y' `indcont' `distcont' `f' (chinanoiv_d_log= z_log), partial(i.sample_state) cluster(sample_state)
eststo anes12a
estadd local state "Yes", replace
estadd local year "Yes", replace 

ivreg2 `y' `indcont' `distcont' `f' (chinavaliv_d_log= zval_log), partial(i.sample_state) cluster(sample_state)
eststo anes12b
estadd local state "Yes", replace
estadd local year "Yes", replace 

ivreg2 `y' `indcont' `distcont' `f' (chinajobsiv_d_log= zjobs_log), partial(i.sample_state)cluster(sample_state)
eststo anes12c
estadd local state "Yes", replace
estadd local year "Yes", replace
}


esttab anes12a anes12b anes12c using output/tablea8.tex, b(3) se(3) wrap label noomitted nobaselevels noconstant replace parentheses stats(N state, fmt(%7.0fc)  labels("Observations" "State Fixed Effects"))  ///
	booktabs nonotes nogaps compress ///
	starlevels( * 0.10 ** 0.05 *** 0.010) ///
	order(chinanoiv_d_log chinavaliv_d_log  chinajobsiv_d_log) ///
	nomtitle mgroups("China Threat == 1", pattern(1 0 0 0)  ///
	prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
	title("Chinese GFDI and Threat Perceptions, Controlling for News Consumption and Manufacturing Occupation")




